<%@ page language="java" pageEncoding="UTF-8" buffer="16kb"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <%@ include file="/module/js.jsp"%>
    <script>
        $(document).ready(function() {
        	//保存课题提交
            var _form=$("#researchProjectForm").validate();
            $("#btnSave").click(function() {
                if(_form.form()){
                        $("#researchProjectForm").attr("action","${basePath}/researchProject/add");
                        $("#researchProjectForm").submit();
                }
            });
            
            /* 返回 */
			$("#btnReturn").click(function() {
	 			   window.location.href='${basePath}/researchProject/index';
	 		});
            
            
			 
        	$("#div1").dialog({
				width : 'auto',
				height : 'auto',
				bgiframe : true,
				modal : true,
				draggable : true,
				resizable : true,
				title : '选择成员',
				autoOpen : false,
			    buttons : {
			    '取消' : function() {
			    	$(this).dialog('close');
				},
				'确定' : function() {
				  var kccy_id = $("#toSelect2 option").map(function(){
					     return $(this).val();
					 }).get().join(",")
				  var kccy_name = $("#toSelect2 option").map(function(){
					     return $(this).text();
					 }).get().join(",")
			      $("#kccy").val(kccy_name);
				  $("#kccy_id").val(kccy_id);
				  $(this).dialog('close');
				}
			  }
			});
            
        }); 
        
        function showdiv() {
    		$('#div1').dialog('open');
    	}
        
        
    </script>
    <style type="text/css">
        .grid{font:12px arial,helvetica,sans-serif;border:1px solid #cccccc}
        .grid td{font:100% arial,helvetica,sans-serif;height:24px;padding:5px}
        .grid{width:100%;border-collapse:collapse}.grid th{background:#eeeeee;height:27px;line-height:27px;border:1px solid #cccccc;padding-left:5px}
        .grid td{border:1px solid #cccccc;padding-left:5px;text-align: center;}
    </style>
</head>
<body>
<div style="text-align: center;padding-bottom: 20px;">
    <span class="table-header">课题信息</span>
</div>

 <form action="#" id="researchProjectForm" name="researchProjectForm">
     <input type="hidden" name="empId" id="empId" value="${user.emid}" />
     <input type="hidden" name="empName" id="empName" value=" ${user.name}" />
     <input type="hidden" name="kccy_id" id="kccy_id" value="" />
     <input type="hidden" id="addType" name="addType" value=""/>
     <input type="hidden" id="stepId" name="stepId" value=""/>
     <input type="hidden" name="type" id="type" value="${type}"/>
     <table cellpadding="0" cellspacing="0" border="0" class="table-border"
            width="95%">
        <tr>
             <td class="table-titleTD" style="width: 15%">
             <font style="color: red;">*</font>标题：</td>
             <td colspan="3" class="table-contentTD" style="width: auto;">
                 <input type="text" id="subject" name="subject" value="" maxlength="50" style="width: 80%" class="inputText required" placeholder="请输入标题"/>
             </td>
         </tr>
         <tr>
             <td class="table-titleTD" style="width: 15%">类别：</td>
             <td class="table-contentTD" style="width: 35%">
             <input type="text" id="kTLB" name="kTLB" value="" maxlength="50" class="inputText" placeholder="请输入类别"/>
             </td>
             <td class="table-titleTD" style="width: 15%">时间：</td>
             <td class="table-contentTD" style="width: 35%">
                 <input name="kTSJ" id="kTSJ" autocomplete="off" readonly="readonly" 
                 value=""
                        class="Wdate inputText2"
                        onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
             </td>
         </tr>
         <tr>
             <td class="table-titleTD" style="width: 15%">提交人：</td>
             <td class="table-contentTD" style="width: 35%">
                ${user.name}
             </td>
             <td class="table-titleTD" style="width: 15%">提交时间：</td>
             <td  colspan="3" class="table-contentTD" style="width: auto;">
             <input type="text" id="createTime"  name="createTime" value="" 
                 maxlength="50"  placeholder="提交时间"
                  class="Wdate inputText2" 
                 onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
             </td>
         </tr>
         <tr>
             <td class="table-titleTD" style="width: 15%">课程成员：</td>
             <td class="table-contentTD" colspan="3" style="width: auto;">
             <input type="text" id="kccy" name="kccy" value="" maxlength="100" readonly="readonly" class="inputText" style="width: 80%"  placeholder="课程成员"/>&nbsp&nbsp;
                 <input type="button" id="btnSelect" value="选择"
                        class="inputButton" onclick="javascript:showdiv();"/>
             </td>
         </tr>
         <tr>
              <td class="table-titleTD" style="width: 15%">关键字：</td>
             <td colspan="3" class="table-contentTD" style="width: auto;">
                 <input type="text" id="keyWords" name="keyWords" value="" maxlength="50" class="inputText " placeholder="请输入关键字"/>
             </td>
         </tr>
          <tr>
             <td class="table-titleTD" style="width: 15%">正文：</td>
             <td class="table-contentTD" colspan="3" style="width: auto;">
                 <textarea rows="5" cols="50"  id="contents" name="contents" maxlength="1000" class="inputText" placeholder="请输入正文">${researchProject.contents}</textarea>
             </td>
         </tr>
     </table>
     <br />
     <table>
          <c:if test="${_login_user_type==2}">
          <tr>
             <td>
              <kl:permission permisstionList="${permisstionList}"
                    currentUser="${_login_console_user}"
                    currentCatalogId="<%=CatalogUtils.getCatalogId(\"JKY_JKS_TJKT\")%>" key="add"> 
             <input type="button" id="btnSave" autocomplete="off"  class="inputButton"
                        style="text-align: center;" value="保存" />
             </kl:permission>	
             </td>
             <td><input type="button" id="btnCancel" autocomplete="off"  class="inputButton"
                       style="text-align: center;" value="取消" /></td>
             <td><input type="button" id="btnReturn" autocomplete="off"  class="inputButton"
                        value="返回" style="text-align: center;" /></td>
         </tr>
         </c:if>
     </table>
 </form>
 
 <div id="div1" style="display: none;">
			<table cellpadding="0" cellspacing="0" border="0"
				class="table-border">
				  <tr>
  	   <td style="clear:both; width: 45%">
  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2','fromSelect2','toSelect2',this.value);"  
  	  onkeyup="javascript:filterSelectItems('sourseFromSelect2','fromSelect2','toSelect2',this.value);"/><font color="green">在此查找</font> <br/>
  	   <br/><label style="color:red;">未选中:</label><br/>
  	   <select name="fromSelect2" id="fromSelect2" multiple="multiple" class="inputText"  style="width:220px; height: 300px;"
			ondblclick="moveField('fromSelect2','toSelect2');">
						<c:forEach items="${employees}" var="data">
							     <option value="${data.emid}">${data.xm}</option>
						</c:forEach>
		</select>
		<select name="sourseFromSelect2" id="sourseFromSelect2" multiple="multiple" class="inputText" style="width:220px; height: 150px; display: none;" 
					ondblclick="moveField('fromSelect2','toSelect2');">
					 <c:forEach items="${eList}" var="data2">
						      <c:forEach items="${employees}" var="data">
							    <c:choose>
							   <c:when test="${data2.emid == data.emid }">  
							   </c:when>
							   <c:otherwise> 
							      <option value="${data.emid}">${data.xm}</option>
							   </c:otherwise>
							</c:choose>    
					      </c:forEach>
						</c:forEach>		
				</select>
  	    </td>
  	    <td align="center" style="width: 10%">
  	    <input type="button"  onclick="moveAllField('fromSelect2','toSelect2');" style="width: 40px;" class="inputButton" value=">>" />
		<br>
		 <br/>
		<input type="button" 
			onclick="moveField('fromSelect2','toSelect2');"
			style="width: 40px;" value=">"  class="inputButton"/>
	   <br/>
	    <br/>
		<input type="button"   style="width: 40px;" value="&lt" class="inputButton" onclick="moveField('toSelect2','fromSelect2');"/><br/> <br/>
     	<input type="button" style="width: 40px;" class="inputButton"  onclick="moveAllField('toSelect2','fromSelect2');"  value="&lt&lt" />
     </td>
     <td style="width: 45%"><br/><br/><label style="color:red;">已选中:</label><br/>
     <select name="toSelect2" id="toSelect2" multiple="multiple"  class="inputText"   style="width:220px;height: 300px;" ondblclick="moveField('toSelect2','fromSelect2');">
			<c:forEach items="${eList}" var="data2">
					<option value="${data2.emid}">${data2.xm}</option>
		    </c:forEach>
		</select>
     </td>
  	   </tr>
		</table>
 </div>
 
</body>
</html>
